{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Initialise the qt5 gui event loop\n",
    "%gui qt5\n",
    "\n",
    "from PyQt5 import Qt\n",
    "from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor\n",
    "\n",
    "from vtkplotter import embedWindow, Plotter, Cone\n",
    "\n",
    "# Tell vtkplotter not to embed the Window\n",
    "embedWindow(False)\n",
    "\n",
    "\n",
    "class MainWindow(Qt.QMainWindow):\n",
    "    def __init__(self, parent=None):\n",
    "\n",
    "        Qt.QMainWindow.__init__(self, parent)\n",
    "        self.frame = Qt.QFrame()\n",
    "        self.vl = Qt.QVBoxLayout()\n",
    "        self.vtkWidget = QVTKRenderWindowInteractor(self.frame)\n",
    "        self.vl.addWidget(self.vtkWidget)\n",
    "\n",
    "        vp = Plotter(qtWidget=self.vtkWidget, axes=4, bg='white')\n",
    "\n",
    "        vp += Cone()\n",
    "        vp.show()      # create renderer and add the actors\n",
    "\n",
    "        # set-up the rest of the Qt window\n",
    "        self.frame.setLayout(self.vl)\n",
    "        self.setCentralWidget(self.frame)\n",
    "\n",
    "        self.show()    # <--- show the Qt Window\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "window = MainWindow()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
